package com.likui.boot.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import com.likui.boot.model.User;
import com.likui.boot.repository.UserDao;

@Service
public class UserService {
	@Autowired
	private UserDao dao;

	public List<User> list() {
		return dao.findAll();
	}

	public User findOne(String id) {
		return dao.findOne(id);
	}

	public Page<User> findAll(PageRequest page) {
		return dao.findAll(page);
	}

	public Page<User> findAll(Specification<User> spec, PageRequest page) {
		return dao.findAll(spec, page);
	}

	public User save(User user) {
		return dao.save(user);
	}

	public void delete(String id) {
		dao.delete(id);
	}
}
